package com.shop.framework.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shop.framework.dao.FileDAO;
import com.shop.framework.vo.FileItem;

@Service
public class FileServiceImpl implements FileService {

    @Autowired
    private FileDAO dao;

    @Override
    public void saveFile(String anex_fil_id_no, String anex_fil_nm, byte[] anex_fil_txt) {
        dao.saveFile(
                anex_fil_id_no,
                anex_fil_nm,
                anex_fil_txt.length,
                anex_fil_txt);
    }

    @Override
    public void deleteFile(String anex_fil_id_no) {
        dao.deleteFile(anex_fil_id_no);
    }

    @Override
    public void touchFile(String anex_fil_id_no) {
        dao.touchFile(anex_fil_id_no);
    }

    @Override
    public FileItem getFile(String anex_fil_id_no) {
        return dao.getFile(anex_fil_id_no);
    }

    @Override
    public FileItem getFileInfo(String anex_fil_id_no) {
        return dao.getFileInfo(anex_fil_id_no);
    }

    @Override
    public int increaseRefCount(String anex_fil_id_no) {
        dao.increaseRefCount(anex_fil_id_no);

        return dao.getRefCount(anex_fil_id_no);
    }

    @Override
    public int decreaseRefCount(String anex_fil_id_no) {
        dao.decreaseRefCount(anex_fil_id_no);

        return dao.getRefCount(anex_fil_id_no);
    }

}
